#include "AnchoredSpring.h"

void AnchoredSpring::updateForce(Particle* particle, float frameTime)
{
	D3DXVECTOR3 force = particle->position - anchor;
	float magnitude = D3DXVec3Length(&force);
	magnitude = abs(magnitude - restLength) * springConstant;
	D3DXVec3Normalize(&force, &force);
	force *= -magnitude;
	particle->force += force;
}